"""Bazel environment for TAPA."""

# Copyright (c) 2024 RapidStream Design Automation, Inc. and contributors.
# All rights reserved. The contributor(s) of this file has/have agreed to the
# RapidStream Contributor License Agreement.

load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("//bazel:v++_rules.bzl", "xilinx_wrapper")

package(default_visibility = ["//visibility:public"])

string_flag(
    name = "xilinx_tool_path",
    build_setting_default = "/opt/tools/xilinx",
)

string_flag(
    name = "xilinx_tool_version",
    build_setting_default = "2024.1",
    values = [
        "2022.1",
        "2022.2",
        "2023.1",
        "2023.2",
        "2024.1",
        "2024.2",
    ],
)

exports_files([
    "nuitka_wrapper.py",
    "pytest_wrapper.py",
])

xilinx_wrapper(
    name = "v++",
    argv0 = "v++",
    tool = "Vitis",
    xrt = True,
)

xilinx_wrapper(
    name = "v++_env.sh",
    tool = "Vitis",
    xrt = True,
)

xilinx_wrapper(
    name = "vitis_hls_env",
    tool = "Vitis_HLS",
)

# Starting from 2024.2, Vivado has renamed rdi to xv
xilinx_wrapper(
    name = "xsc_xv",
    argv0 = "xsc",
    tool = "Vivado",
    tool_version = "2024.2",
)

# Use the oldest supported version to ensure compatibility
xilinx_wrapper(
    name = "xsc_legacy_rdi",
    argv0 = "xsc",
    tool = "Vivado",
    tool_version = "2022.1",
)
